# -*- coding:utf-8 -*-

class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if strs is None or len(strs)==0:
            return ""
        pre = strs[0]
        for s in strs:
            while not s.startswith(pre):
                pre = pre[0:len(pre)-1]
        return pre

if __name__ == "__main__":
    print Solution().longestCommonPrefix(['abc','ab'])